import { EntityModel } from '@midwayjs/orm';
import { Column, ManyToOne, OneToMany } from 'typeorm';
import { BaseModel } from '../utils/base.model';

@EntityModel()
export class Department extends BaseModel {
  @Column({
    comment: '部门名称',
  })
  name: string;

  @Column({
    comment: '联系人',
  })
  contact: string;

  @Column({
    comment: '联系电话',
  })
  tel: string;

  @OneToMany(() => Department, department => department.children)
  parent: Department;

  @ManyToOne(() => Department, department => department.parent)
  children: Department[];
}
